package io.github.generator;

import com.baomidou.mybatisplus.generator.config.IConfigBuilder;
import com.baomidou.mybatisplus.generator.config.builder.CustomFile;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Map;
import java.util.function.BiConsumer;

/**
 * 自定义文件扩展类
 *
 * @author haijun
 * @version 1.0.0
 * @email "mailto:zhonghaijun@zhxx.com"
 * @date 2024.11.22 10:20
 * @since 1.0.0
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class CustomFileExtend extends CustomFile {

    /** Extend consumer */
    private BiConsumer<TableInfo, Map<String, Object>> extendConsumer;

    /**
     * 自定义扩展Builder
     *
     * @author zhonghaijun
     * @version 1.0.0
     * @email "mailto:zhonghaijun@zhxx.com"
     * @date 2024.11.22 10:25
     * @since 1.0.0
     */
    public static class Builder implements IConfigBuilder<CustomFileExtend> {

        /** Custom file extend */
        private final CustomFileExtend customFileExtend = new CustomFileExtend();

        @Override
        public CustomFileExtend build() {
            return this.customFileExtend;
        }
    }
}
